<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_knowledge.*" %>
<%@ page import="com.lmpop.trade.ts_category.*" %>

<%@page import="java.util.*" %>
<html>
  <head>
    
    <title>知识库管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>

	<script type="text/javascript" src="index.js"></script>
</head>

<body>

  <% 

	
  	String info_id="";
  	if(request.getParameter("info_id")!=null) 
	info_id = request.getParameter("info_id");

		String flag_code = "";
 
	if(request.getParameter("flag_code")!=null){
		flag_code = request.getParameter("flag_code");
	}
	 String class_attr="";
if(request.getParameter("class_attr")!=null)
	class_attr=request.getParameter("class_attr");


  	Ti_knowledgeInfo ti_knowledgeInfo = new Ti_knowledgeInfo();
  	List list = ti_knowledgeInfo.getListByPk(info_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String up_info_id="",cust_id="",up_class_attr="",title="",keyword="",content="",is_recom="",in_date="",user_id="";
  	if(map.get("info_id")!=null) up_info_id = map.get("info_id").toString();
	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	if(map.get("class_attr")!=null) up_class_attr = map.get("class_attr").toString();
  	if(map.get("title")!=null) title = map.get("title").toString();
  	if(map.get("keyword")!=null) keyword = map.get("keyword").toString();
  	if(map.get("content")!=null) content = map.get("content").toString();
  	if(map.get("is_recom")!=null) is_recom = map.get("is_recom").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
	

	Ts_categoryInfo  ts_categoryInfo  = new Ts_categoryInfo();
	

	Map catMap = ts_categoryInfo.getCatClassMap("5");
	String catAttr[] = class_attr.split("\\|");
	String cat_names ="";  
	if(!class_attr.equals("")){
	  String catIds[] =	class_attr.split("\\|");	
	  for(String catId:catIds){
		 if(catMap!=null){
			 if(catMap.get(catId)!=null){
			  cat_names += catMap.get(catId).toString() + " > ";                 
			 }                  
		 }                 
	  }		    
	}


	

	
  %>
	
	<h1>修改知识库</h1>	
	
	<form action="/doTradeReg.do" method="post" name="addForm" target="_self" onsubmit="return false;">
	
	<input name="cust_id" id="cust_id" type="hidden" value="<%=cust_id%>"/>	
	<input name="user_id" id="user_id" type="hidden" value="<%=user_id%>"/>	
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
	
		<tr>
			<td align="right" width="20%">
				你选择的类目:			
			</td>
			<td  colspan="3">
			   <font color="red"><%=cat_names%></font> 
				 &nbsp;&nbsp;<input class="button_css" type="button" value ="返回，重新选择类目" onclick="window.location.href='addInfo.jsp?flag_code=1&info_id=<%=info_id%>'">	
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				标题<font color="red">*</font>
			</td>
			<td><input name="title" id="title" size="50" maxlength="200" value="<%=title %>" type="text" /></td>
		</tr>
		

		<tr>
			<td align="right" width="20%">
				产品图片:			
			</td>
			<td colspan="3">
			 <jsp:include page="/program/inc/uploadImgInc.jsp">
					<jsp:param name="attach_root_id" value="<%=info_id%>" />
					<jsp:param name="img_type" value="1" />
				</jsp:include>
			</td>
		</tr> 
		<tr>
			<td align="right" width="10%">
				关键字:
			</td>
			<td><input name="keyword" id="keyword" size="50" maxlength="200" value="<%=keyword %>" type="text" /></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				内容<font color="red">*</font>
			</td>
			<td colspan="3"><textarea name="content" id="content"><%=content%></textarea>
				<script type="text/javascript" src="/program/plugins/ckeditor/ckeditor.js"></script>
				<script type="text/javascript">
					
					CKEDITOR.replace( 'content',{
			   			filebrowserUploadUrl : '/program/inc/upload.jsp?type=file&attach_root_id=<%=info_id%>',      
						filebrowserImageUploadUrl : '/program/inc/upload.jsp?type=img&attach_root_id=<%=info_id%>',      
						filebrowserFlashUploadUrl : '/program/inc/upload.jsp?type=flash&attach_root_id=<%=info_id%>'  
					});  
				</script>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				是否推荐:
			</td>				
			<td>
			<select name="is_recom"  id="is_recom">				
					<option value="">请选择</option>
					<option value="0" <%if(is_recom.equals("0"))out.println("selected");%>>不推荐</option>
					<option value="1" <%if(is_recom.equals("1"))out.println("selected");%>>推荐</option>					
				</select>
			</td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" id="bpm_id"value="4443" />
				<input type="hidden" name="info_id" id="info_id"value="<%=info_id %>" />
				<input type="hidden" name="class_attr" id="class_attr"value="<%=class_attr %>" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onclick="return checkSub();"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
